﻿using System.Data.Entity.ModelConfiguration;
using CodeFirstEntityConfiguration.Models;

namespace CodeFirstEntityConfiguration.Infrastructure
{
    public class PostConfiguration : EntityConfiguration<Post>
    {
        public PostConfiguration()
            : base()
        {
            MapSingleType(post => new
                                      {
                                          post_id = post.Id,
                                          title = post.Title,
                                          body = post.Body,
                                          created_by = post.CreatedBy,
                                          created_on = post.CreatedOn
                                      }).ToTable(new StoreTableName("tbPosts", "dbo"));
        }
    }
}